import 'package:shared_preferences/shared_preferences.dart';
class shareData {
  bool exist;
  String showName;
   shareData(this.exist,this.showName);

  static saveData(String key,String value) async{

    SharedPreferences prefs = await SharedPreferences.getInstance();

    prefs.setString(key, value);//存储值

  }
   static Future<String> get(String key) async {
    var userName;
    SharedPreferences prefs = await SharedPreferences.getInstance();
    userName = prefs.getString(key);//获取值
    return userName;
  }

  static clearData(String key)async{

    SharedPreferences prefs = await SharedPreferences.getInstance();

    prefs.remove(key);//清空某个key

  }

  static clearAll()async{


    SharedPreferences prefs = await SharedPreferences.getInstance();

    prefs.clear();//清空所有

  }


}